<!-- f r o m 7 5  2 7 1  8 9 2 0 -->
<template>
  <a-row :gutter="24">
    <a-col :md="24">
      <a-card :style="cardStyle" :bordered="false">

        <!-- table区域-begin -->
        <div>
          <a-table
            ref="table"
            size="middle"
            bordered
            rowKey="id"
            :columns="columns"
            :dataSource="dataSource"
            :pagination="ipagination"
            :scroll="scroll"
            :loading="loading"
            :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
            @change="handleTableChange">
            <span slot="action" slot-scope="text, record">
               <a @click="myHandleDetail(record, '个人信息')">查看</a>
               <a-divider v-if="btnEnableList.indexOf(1)>-1" type="vertical" />
              <a @click="handleEdit(record)">修改</a>
<!--              <a-divider v-if="btnEnableList.indexOf(1)>-1" type="vertical" />-->
<!--              <a-popconfirm v-if="btnEnableList.indexOf(1)>-1" title="确定删除吗?" @confirm="() => handleDelete(record.id)">-->
<!--                <a>删除</a>-->
<!--              </a-popconfirm>-->
            </span>
            <!-- 状态渲染模板 -->
            <template slot="customRenderFlag" slot-scope="enabled">
              <a-tag v-if="enabled" color="green">启用</a-tag>
              <a-tag v-if="!enabled" color="orange">禁用</a-tag>
            </template>
          </a-table>
        </div>
        <!-- table区域-end -->
        <!-- 表单区域 -->
        <me-modal ref="modalForm" @ok="modalFormOk"></me-modal>
<!--        <retail-out-modal ref="modalForm" @ok="modalFormOk"></retail-out-modal>-->
        <bill-detail ref="modalDetail"></bill-detail>
      </a-card>
    </a-col>
  </a-row>
</template>
<!-- BY cao_yu_li -->
<script>
  import MeModal from './modules/MeModal'
  import BillDetail from '../bill/dialog/BillDetail'
  import { BillListMixin } from '../bill/mixins/BillListMixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import { openDownloadDialog, sheet2blob} from "@/utils/util"
  import JDate from '@/components/jeecg/JDate'
  import Vue from 'vue'
  export default {
    name: "MeList",
    mixins:[JeecgListMixin,BillListMixin],
    components: {
      MeModal,
      BillDetail,
      JDate
    },
    data () {
      return {
        labelCol: {
          span: 5
        },
        wrapperCol: {
          span: 18,
          offset: 1
        },
        // 查询条件
        queryParam: {
          supplier:'',
          type:'客户',
          telephone:'',
          phonenum:''
        },
        ipagination:{
          pageSizeOptions: ['10', '20', '30', '100', '200']
        },
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:30,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          { title: '名称', dataIndex: 'stuName',width:30,align:"center"},
          { title: '班级', dataIndex: 'cname',width:30,align:"center"},
          { title: '性别', dataIndex: 'sex',width:30,align:"center"},
          // { title: '分数', dataIndex: 'fraction',width:50,align:"center"},
          // { title: '课程', dataIndex: 'coursename',width:80,align:"center"},
          // { title: '身份证号', dataIndex: 'stuId',width:130,align:"center"},
          // { title: '手机号', dataIndex: 'stuPhone',width:110,align:"center"},
          // { title: '接种疫苗第一针时间',dataIndex: 'stuVero1',width:110,align:"center"},
          // { title: '接种疫苗第二针时间',dataIndex: 'stuVero2',width:110,align:"center"},
          // { title: '接种疫苗第三针时间', dataIndex: 'stuVero3',width:110,align:"center"},
          // { title: '地址', dataIndex: 'stuAddress',width:150,align:"center"},
          // { title: '姓名', dataIndex: 'parentName',width:80,align:"center"},
          // { title: '手机号', dataIndex: 'parentPhone',width:110,align:"center"},
          // { title: '身份证号', dataIndex: 'parentId',width:130,align:"center"},
          // { title: '工作', dataIndex: 'parentCareer',width:80,align:"center"},
          // { title: '关系', dataIndex: 'parentRelation',width:50,align:"center"},
          // { title: '状态',dataIndex: 'enabled',width:70,align:"center",
          //   scopedSlots: { customRender: 'customRenderFlag' }
          // },
          {
            title: '操作',
            dataIndex: 'action',
            width: 50,
            align:"center",
            scopedSlots: { customRender: 'action' },
          }
        ],
        url: {
          list: "/student/list",
          delete: "/student/delete",
          deleteBatch: "/supplier/deleteBatch",
          importExcelUrl: "/supplier/importCustomer",
          exportXlsUrl: "/supplier/exportExcel",
          batchSetStatusUrl: "/supplier/batchSetStatus"
        }
      }
    },
    computed: {
      importExcelUrl: function () {
        return `${window._CONFIG['domianURL']}${this.url.importExcelUrl}`;
      }
    },
    methods: {
      searchReset() {
        this.queryParam = {
          type:'客户',
        }
        this.loadData(1);
      },
      handleEdit: function (record) {
        this.$refs.modalForm.edit(record);
        this.$refs.modalForm.title = "编辑";
        this.$refs.modalForm.disableSubmit = false;
        if(this.btnEnableList.indexOf(1)===-1) {
          this.$refs.modalForm.isReadOnly = true
        }
      },
      onColChange (checkedValues) {
        this.columns = this.defColumns.filter(item => {
          if (checkedValues.includes(item.dataIndex)) {
            return true
          }
          return false
        })
        let columnsStr = checkedValues.join()
        Vue.ls.set('materialColumns', columnsStr)
      },
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>